#include <string.h>
#include <stdio.h>

int startsWith(const char* container, const char* target)
{
  size_t clen = strlen(container), tlen = strlen(target);
  if (clen < tlen)
    return 0;
  return strncmp(container, target, tlen) == 0;
}

int endsWith(const char* container, const char* target)
{
  size_t clen = strlen(container), tlen = strlen(target);
  if (clen < tlen)
    return 0;
  return strncmp(container + clen - tlen, target, tlen) == 0;
}

int doesContain(const char* container, const char* target)
{
  return strstr(container, target) != 0;
}

int main(void)
{
  char *s1 = "abcd";
  char *s2 = "abab";
  char *s3 = "ab";
  if (doesContain(s1, s3)) 
    printf("Found match\n");
  else
    printf("Did not find any matches\n");	 
  if (doesContain(s1, s2)) 
    printf("Found match\n");
  else
    printf("Did not find any matches\n");

  return 0;
}
